class VersionInfo {
  String? version;
  String? remoteUrl;
  String? mniVersion;

  //1 强制更新 2 提醒更新 3 静默更新
  int? upgradeType;
  String? title;
  String? desc;
  List<Histories>? histories;

  //wfj:20230829添加,后台还没添加该参数，前端备用，方便后端控制更新样式
  int? style; //0：应用内下载弹窗1：旧弹窗（跳转浏览器下载）

  VersionInfo(
      {this.version,
      this.remoteUrl,
      this.mniVersion,
      this.upgradeType,
      this.title,
      this.desc,
      this.histories,
      this.style});

  VersionInfo.fromJson(Map<String, dynamic> json) {
    version = json['version'];
    remoteUrl = json['remote_url'];
    mniVersion = json['mni_version'];
    upgradeType = json['upgrade_type'];
    title = json['title'];
    desc = json['desc'];
    if (json['histories'] != null) {
      histories = <Histories>[];
      json['histories'].forEach((v) {
        histories!.add(Histories.fromJson(v));
      });
    }
    style = json['style'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['version'] = version;
    data['remote_url'] = remoteUrl;
    data['mni_version'] = mniVersion;
    data['upgrade_type'] = upgradeType;
    data['title'] = title;
    data['desc'] = desc;
    if (histories != null) {
      data['histories'] = histories!.map((v) => v.toJson()).toList();
    }
    data['style'] = style;
    return data;
  }
}

class Histories {
  String? version;
  int? upgradeType;
  String? desc;

  Histories({this.version, this.upgradeType, this.desc});

  Histories.fromJson(Map<String, dynamic> json) {
    version = json['version'];
    upgradeType = json['upgrade_type'];
    desc = json['desc'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['version'] = version;
    data['upgrade_type'] = upgradeType;
    data['desc'] = desc;
    return data;
  }
}
